package net.sevear.chaos.view
{
	import com.douban.event.ClosePanelEvent;
	
	import flash.events.MouseEvent;
	
	import mx.containers.Canvas;
	import mx.controls.Button;
	import mx.core.UIComponent;
	
	public class DBRadioBasePanel extends Canvas
	{
		private var closeBtn:Button;
		
		public var closePanelHandler:Function;
		public function DBRadioBasePanel(width:int = 274,height:int=300)
		{
			super();
			this.width = width;
			this.height = height;
			drawBg();
			closeBtn = new Button();
			closeBtn.width = closeBtn.height = 20;
			closeBtn.setStyle('styleName','closeBtn');
			this.addChild(closeBtn);
			closeBtn.right = 5;
			closeBtn.top = 5;
			closeBtn.addEventListener(MouseEvent.CLICK,onClickCloseBtn);
		}
		
		private function drawBg():void{
			this.graphics.clear();
			this.graphics.beginFill(0xe6e6e6,0.33);
			this.graphics.drawRect(0,0,this.width,this.height);
			this.graphics.beginFill(0x9b9b9b,0.77);
			this.graphics.drawRoundRect(10,10,this.width-20,this.height-20,10,10);
			this.graphics.endFill();
		}
		
		private function onClickCloseBtn(e:MouseEvent):void{
			dispatchEvent(new ClosePanelEvent());
		}
	}
}